{extend name="base_mobile" /}
{block name="css"}
<link rel="stylesheet" href="/static/weui/css/pages/xunjia_detail.css" media="all">
<link rel="stylesheet" href="__CSS__/fonts.css">
{/block}
{block name="body"}
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>{$customer.cname}</h1>
    <div id="hui-header-menu" onclick="hui.showSlideMenu();"></div>
</header>
<div class="hui-wrap">
    <div class="hui-list" style="margin-top:12px;">
        <a href="javascript:hui.toast('Hello Hcoder UI !');" style="height:auto; height:80px; padding-bottom:8px;">
            <div class="hui-list-icons" style="width:110px; height:80px;">
                <img src="/static/hui/img/index/account.png" style="width:66px; margin:0px; border-radius:50%;" />
            </div>
            <div class="hui-list-text" style="height:79px; line-height:79px;">
                {$customer.cname}
                <div class="hui-list-info">
                    {:user_config_toval('intention',$customer['intention'],'customer')}
                </div>
            </div>
        </a>
        <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">
                {:user_config_totitle('type','customer')}：{:user_config_toval('type',$customer['type'],'customer')}
            </div>
            <div class="hui-list-text">
                {:user_config_totitle('come_from','customer')}：{:user_config_toval('come_from',$customer['come_from'],'customer')}
            </div>
        </a>
        <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">
                {:user_config_totitle('status','customer')}：{:user_config_toval('status',$customer['status'],'customer')}
            </div>
            <div class="hui-list-text">
                跟进人：{:get_user_realname($customer['uid'])}
            </div>
        </a>
        <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">
                添加：{:time_trans($customer.create_time)}
            </div>
            <div class="hui-list-text">
                更新：{:time_trans($customer.update_time)}
            </div>
        </a>
        {foreach name="config_customer" item="r"}
        <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">
                {$r.title}：{if $r.type eq 'input'}
                {if isset($customer.jdata[$r.name])}{$customer.jdata[$r.name]}{/if}
                {/if}
                {if $r.type eq 'textarea'}
                {if isset($customer.jdata[$r.name])}{$customer.jdata[$r.name]}{/if}
                {/if}
                {if $r.type eq 'select'}
                {if isset($customer.jdata[$r.name])}{:user_config_toval($r.name,$customer.jdata[$r.name],'customer')}{/if}
                {/if}
                {if $r.type eq 'radio'}
                {if isset($customer.jdata[$r.name])}{:user_config_toval($r.name,$customer.jdata[$r.name],'customer')}{/if}
                {/if}
                {if $r.type eq 'image'}
                {if isset($customer.jdata[$r.name])}<img src="{$customer.jdata[$r.name]}">{/if}
                {/if}
            </div>
        </a>
        {/foreach}
        <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">
                地址：{$customer.province}{$customer.city}{$customer.area} {$customer.address}
            </div>
        </a>
        <a href="javascript:hui.toast('Hello Hcoder UI !');">
            <div class="hui-list-text">
                备注：{if $customer.remark}{$customer.remark}{else}无{/if}
            </div>
        </a>
    </div>
    <a href="javascript:hui.open('tel:{$customer.mobile}');" class="hui-button hui-success hui-button-large" style="margin-bottom:15px;font-size:26px;"><i class="fa fa-phone"></i>  {$customer.mobile}</a>
    <div style="padding-top:5px;">
        <a href="javascript:hui.open('{:url('user/customer/edit', ['id' => $id])}');" class="hui-button hui-button-small hui-primary hui-fl" style="width:25%"><i class="fa fa-edit"></i> 修改</a>
        <a href="javascript:hui.open('{:url('user/customer/add_track', ['id' => $id])}');" class="hui-button hui-button-small hui-danger hui-fl" style="width:25%"><i class="fa fa-check-square-o"></i> 写跟进</a>
        <a href="javascript:hui.open('{:url('user/customer/add_remind', ['id' => $id])}');" class="hui-button hui-button-small hui-primary hui-fl" style="width:25%"><i class="fa fa-clock-o"></i> 设提醒</a>
        <a href="javascript:hui.open('{:url('user/order/add', ['cid' => $id])}');" class="hui-button hui-button-small hui-danger hui-fl" style="width:25%"><i class="fa fa-user-plus"></i> 录订单</a>
    </div>
    <div style="padding:10px 0px;">
        <div class="hui-tab">
            <div class="hui-tab-title">
                <div>跟踪记录<span class="hui-badge hui-danger">{:count($track)}</span></div>
                <div>提醒记录<span class="hui-badge hui-danger">{:count($remind)}</span></div>
                <div>交易记录<span class="hui-badge hui-danger">{:count($order)}</span></div>
            </div>
            <div class="hui-tab-body">
                <div class="hui-tab-body-items">
                    <div class="hui-tab-item hui-list">
                        {foreach name="track" item="r"}
                        <?php $user = \app\common\model\User::get($r['uid']);?>
                        <div class="hui-accordion">
                            <div class="hui-accordion-title">{$r.create_time} - {:user_config_toval('type',$r['type'],'track')} - {if $user['realname']}{$user.realname}{else}{$user.username}{/if}</div>
                            <div class="hui-accordion-content" style="line-height:22px;padding-left:20px;">
                                {foreach name="config_track" item="v"}
                                <b>{$v.title}：</b>
                                    {if $v.type eq 'input'}
                                    {if isset($r.jdata[$v.name])}{$r.jdata[$v.name]}{/if}
                                    {/if}
                                    {if $v.type eq 'textarea'}
                                    {if isset($r.jdata[$v.name])}{$r.jdata[$v.name]}{/if}
                                    {/if}
                                    {if $v.type eq 'select'}
                                    {if isset($r.jdata[$v.name])}{:user_config_toval($v.name,$r.jdata[$v.name],'track')}{/if}
                                    {/if}
                                    {if $v.type eq 'radio'}
                                    {if isset($r.jdata[$v.name])}{:user_config_toval($v.name,$r.jdata[$v.name],'track')}{/if}
                                    {/if}
                                    {if $v.type eq 'image'}
                                    {if isset($r.jdata[$v.name])}<img src="{$r.jdata[$v.name]}" >{/if}
                                    {/if}<br>
                                {/foreach}
                                <b>跟踪备注：</b>{$r.remark}
                            </div>
                        </div>
                        {/foreach}
                        <div class="pages">{$track->mobile_render()}</div>
                    </div>
                    <div class="hui-tab-item hui-list">
                        {foreach name="remind" item="r"}
                        <a id="btnremind{$r.id}">
                            <div class="hui-list-text">
                                <?php echo date('Y-m-d',$r['remind_time'])?> &nbsp;&nbsp;&nbsp;{$r.remark}
                                <span class="right" style="padding-top:8px;padding-right: 10px;">
                                    {if $r['status']=='0'}
                                    <button  class="hui-button hui-button-small hui-danger hui-fl">待处理</button>
                                    {else}
                                    <button  class="hui-button hui-button-small hui-primary hui-fl">已处理</button>
                                    {/if}
                                </span>
                            </div>
                        </a>
                        {/foreach}
                    </div>
                    <div class="hui-tab-item hui-list">
                        {foreach name="order" item="o"}
                        <a id="btnorder{$o.id}">
                            <div class="hui-list-text">
                                {$o['create_time']} &nbsp;&nbsp;&nbsp;￥ {$o.total} 元
                            </div>
                        </a>
                        {/foreach}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<br><br><br>
{/block}
{block name="js"}
<script type="text/javascript" src="/static/hui/js/hui-accordion.js"></script>
<script type="text/javascript">
{foreach name="remind" item="r"}
hui('#btnremind{$r.id}').click(function(){hui.alert('{if $r["status"]==1}{$r.status_remark}({$r.status_time}){/if}','好的', function(){});});
{/foreach}
{foreach name="order" item="o"}
hui('#btnorder{$o.id}').click(function(){hui.alert('{$o.remark}','好的', function(){});});
{/foreach}
hui.accordion(true, false);

</script>
<script src="/static/hui/js/hui-tab.js" type="text/javascript"></script>
<script type="text/javascript">
hui.tab('.hui-tab');
</script>
{/block}